package com.aiwiown.face.request;

import com.aiwiown.face.ApiMethod;
import com.aiwiown.face.ApiObject;
import com.aiwiown.face.ApiRequest;
import com.aiwiown.face.internal.util.RequestParamUtils;
import com.aiwiown.face.response.FaceCompareResponse;

import java.util.Map;

/**
 * 描述
 * 将两个人脸进行比对，来判断是否为同一个人，返回比对结果置信度和不同误识率下的阈值。
 *
 * 支持传入图片或 face_token 进行比对。使用图片时会自动选取图片中检测到人脸尺寸最大的一个人脸。
 * https://console.faceplusplus.com.cn/documents/4887586
 * @ClassName : FaceCompareRequest
 * @Description :
 * @Author : dbin0123
 * @Date: 2020-03-14 18:48
 */
public class FaceCompareRequest implements ApiRequest<FaceCompareResponse> {

    private String apiVersion = "v3";
    private static String apiUrl = "/compare";

    private String bizContent;
    private ApiObject bizModel = null;

    @Override
    public ApiMethod getApiMethod() {
        return ApiMethod.POST;
    }

    @Override
    public String getApiUrl() {
        return "/" + this.apiVersion + apiUrl;
    }

    @Override
    public Map<String, String> getTextParams() throws IllegalAccessException {
        return RequestParamUtils.getTextParams(this.bizModel);
    }

    @Override
    public Map<String, byte[]> getByteArrayParams() throws IllegalAccessException {
        return RequestParamUtils.getByteArrayParams(this.bizModel);
    }

    @Override
    public Class<FaceCompareResponse> getResponseClass() {
        return FaceCompareResponse.class;
    }

    @Override
    public String getApiVersion() {
        return this.apiVersion;
    }

    @Override
    public String getBizContent() {
        return this.bizContent;
    }

    public void setBizModel(ApiObject bizModel) {
        this.bizModel = bizModel;
    }

    @Override
    public String signVersion() {
        return null;
    }

    @Override
    public String getSignInfo(String apiKey, String secretKey) throws Exception {
        return null;
    }
}
